package com.qinggeng.project.api.dto;

import com.qinggeng.project.system.domain.OrdersPoint;
import lombok.Data;

/**
 * 订单配送点
 */
@Data
public class OrdersPointDto {

    /** 配送点ID */
    private Long id;

    /** 配送点名称 */
    private String pointName;

    /** 果果专员Id*/
    private Long courierId;

    /** 详细地址 */
    private String address;

    private Float lng;

    private Float lat;

    /** 配送时间 */
    private String businessTime;

    /** 配送下班时间 */
    private String closingTime;

    /** 距离 */
    private Double distance;
    /** 距离 */
    private String distanceName;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPointName() {
        return pointName;
    }

    public Long getCourierId() {
        return courierId;
    }

    public void setCourierId(Long courierId) {
        this.courierId = courierId;
    }

    public void setPointName(String pointName) {
        this.pointName = pointName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Float getLng() {
        return lng;
    }

    public void setLng(Float lng) {
        this.lng = lng;
    }

    public Float getLat() {
        return lat;
    }

    public void setLat(Float lat) {
        this.lat = lat;
    }

    public String getBusinessTime() {
        return businessTime;
    }

    public void setBusinessTime(String businessTime) {
        this.businessTime = businessTime;
    }

    public String getClosingTime() {
        return closingTime;
    }

    public void setClosingTime(String closingTime) {
        this.closingTime = closingTime;
    }

    public Double getDistance() {
        return distance;
    }

    public String getDistanceName() {
        return distanceName;
    }

    public void setDistanceName(String distanceName) {
        this.distanceName = distanceName;
    }

    public static OrdersPointDto news(OrdersPoint ordersPoint) {
        OrdersPointDto dto = new OrdersPointDto();
        dto.setId(ordersPoint.getPointId());
        dto.setAddress(ordersPoint.getAddress());
        dto.setBusinessTime(ordersPoint.getBusinessTime());
        dto.setClosingTime(ordersPoint.getClosingTime());
        dto.setPointName(ordersPoint.getPointName());
        dto.setCourierId(ordersPoint.getCourierId());
        return dto;
    }


    public void setDistance(Double distance) {
        this.distance = distance;
        this.distanceName = Double.valueOf(String.format("%.2f", distance)) + "km";
    }
}
